package com.taihe.util;

import com.taihe.service.UserService;
import com.taihe.service.impl.UserServiceImpl;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by zwt on 2018/7/23.
 */
public class FactoryTest {
    private static final Map<Integer,Class> clazz = new HashMap<>();
    static {
        clazz.put(1, UserServiceImpl.class);//待处理的推送单
       /* clazz.put((byte)1, ExpiryPushServiceImpl.class);//已失效的推送单
        clazz.put((byte)3, ProcessedPushServiceImpl.class);// 已处理的推送单*/
    }
    public static UserService instance(Integer status) {
        Class beanClass = clazz.get(status);
        if (beanClass == null) return null;

        UserService userService = (UserService) SpringUtil.getBean(beanClass);
        return userService;
    }
}
